package com.logistics.account.entity.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;

import com.baomidou.mybatisplus.annotation.TableName;
import com.logistics.account.entity.model.AccountRoleSave;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * <p>
 * 
 * </p>
 *
 * @author zhiyu.fan
 * @since 2024-05-14
 */
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("sys_account_role")
public class AccountRole implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;

    private Integer accountId;

    private Integer roleId;

    public AccountRole(){

    }

    public AccountRole(AccountRoleSave save){
        this.accountId = Integer.parseInt(save.getAccountId());
        this.roleId = Integer.parseInt(save.getRoleId());
    }

    public static AccountRole build(AccountRoleSave save){
        return new AccountRole(save);
    }
}
